package com.iotp.utils.conf;

import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 图片映射
 */
//@Configuration
public class ImgConfig extends WebMvcConfigurationSupport {
    @Value("${pic.pastePath}")
    private String mImagesPath;
    //访问图片方法
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //访问前缀，图片路径
        registry.addResourceHandler("/pic/**").addResourceLocations("file:"+mImagesPath);
        super.addResourceHandlers(registry);
    }
}
